home *** CD-ROM | disk | FTP | other *** search
- Tom's Plasma! by Tom Dibble, Copyright 1994
-
-
- *TPLAS MANUAL*
-
-
- -----------------------------------------------------------------
- TPLAS (T '-Plaz): [Abbr. "Tom's Plasma"] Screen effects program
- by Tom Dibble.
- -----------------------------------------------------------------
-
-
- AUTHOR'S NOTE:
-
- Thank-you for taking a look at my little program! I realize there
- are plenty of programs at these shareware sites worthy of a second
- look, yet you devoted a few moments of your time to evaluating my
- efforts. For that I am certainly appreciative, and I hope you are
- not disappointed in your expectations.
-
- This program started out as a trivial exercise in creating a Plasma
- Fractal and employing a technique called "Swimming" on that fractal
- (see the Tech section for more info). Further effects were then
- added, one atop the other, until ... The result is a rather unique
- program which in function fits somewhere between the "kaleidoscope"
- screen effects programs such as Dazzle (from Worldwide
- Microtronics, Inc) and screen "saver" programs such as AfterDark
- (from Berkeley Labs).
-
- To keep with the original purpose of Tom's Plasma, the release of
- this revision contains the entirety of the source code to create
- Tom's Plasma revision 1.1, which merely generated the plasma
- fractal and then employed the "swimming" effect. Copyrights on
- this code are explained in the TPlas11.DOC file. The document and
- source code files are all included in the Zip file "TPlas11.ZIP",
- which should be "un-zipped" using "PKUnzip" version 2.0g or newer,
- or using a version of the free "Unzip" newer than late 1993
- (compatible with PKUnzip 2.0+).
-
- Revision 2.0 of Tom's Plasma is released as Shareware, in hopes of
- regaining at least *some* compensation for the many hours spent
- improving it, mostly in the form of knowing people are actually
- using it. I wrote it with no such hopes in mind, purely as an
- exercise in programming, and so the price I am charging is
- deliberately low (well below those asked for by Dazzle and required
- by AfterDark), at $10.00 (US). Benefits of registration include:
-
- That warm feeling of knowing you've supported Shareware!
-
- A Registered Version of the program, which includes the
- Manual and Semi-Automatic modes detailed below.
-
- Optional Full Source Code (of interest to programmers out
- there). Interest in source code must be explicitly
- stated on the order form.
-
- Well, that's all the general stuff *about* this program. I suggest
- you read on for more details concerning how to use the program,
- especially the "Keys" and "Caveats" sections.
-
- IF YOU ARE A BUSINESS:
-
- If you are a representative of a business, you may use the
- Demonstration version of Tom's Plasma ("Demo.COM") at no cost, but
- only on business computers in a public setting. A public setting
- is defined as anywhere I could get to without having to ask anyone,
- or in which a large portion of people are gathered. This includes
- computer shows and demonstration settings as well as some office
- settings. I offer this version as free to these users because they
- are, in effect, my advertisement. The Demonstration version is
- identical to the Unregistered version except that it does not ask
- you to register (and requires no registration, for qualified users)
- and includes an identifying effect (which simply says "You are
- watching a demonstration of Tom's Plasma").
-
- Demonstration versions which include a reduced set of effects (such
- that the effects which are slow on a specific computer are not
- generated) *may* be obtained by personal correspondence with me.
- The cost is $10.00 (US), just like the Registered version; however,
- these programs suffer the same restrictions as the Demonstration
- Version, and entitle the purchaser to none of the Benefits included
- in the Registered Version. As a result of being analogous to the
- Demonstration Version, on the other hand, such reduced-effect
- versions of Tom's Plasma may be freely distributed, so long as they
- are clearly identified as reduced-effect versions. Details
- concerning the distribution of these versions will be included with
- the program or available pre-purchase upon request. This offer is
- separate from all claims concerning Revision 2.0 of Tom's Plasma,
- and availability is dependant on my time and whim.
-
-
- FILES WHICH SHOULD HAVE BEEN INCLUDED:
-
- TPLAS.COM The program itself, unregistered.
- TOMSPLAS.DAT Data file for the program.
- INSTALL.BAT Installation batch file.
- DEMOINST.BAT Demo installation.
- TPLAS11.ZIP Old version+source.
- TPLAS.DOC This file.
- REGISTER.DOC Registration file.
-
-
- TECHNICAL STUFF NO ONE WANTS TO KNOW:
-
- Well, you asked for it! This is Tom's (that's me) Plasma. It puts
- a quick plasma fractal (*NOT* a sin/cos function!) up on screen,
- then swims the fractal in a center window while cycling the colors.
- That's it. But I think that deserves some explanation, don't you?
-
-
- First off, what is plasma?
-
- The plasma display implemented here falls into a class of images
- called "Fractals". A fractal can be zoomed in infinitely without
- loss of detail. Although I do not allow you to zoom in on this
- particular fractal, the difference between 'fractal plasma' and
- 'sin/cos plasma' is readily apparent. The only real commonalities
- is that both generate a fully continuous array of values. In
- certain applications, the values in the array are used as
- elevations or terrains of ground. In this application, the values
- are represented by color.
-
- The main difference between these two types of plasma, aside from
- the obvious visual difference, is that fractal plasma utilizes a
- random value by its very definition, and therefore is different
- every time it is generated. Sin/cos plasma is a set function,
- usually implemented with zero random nature, and therefore does not
- change between viewings.
-
-
- Okay, so what's this "swimming" thing?
-
- For lack of a better name, the display technique I've used here I
- will refer to as 'swimming'. I originally came across swimming in
- a program called "JCL-Plasm" by Jeremy Longley. He claims to have
- copied the effect from Thomas Hagen. Both implementations of
- swimming involved using a sin/cos plasma rather than a fractal
- plasma.
-
- Swimming can best be described in a simple form of one pointer. A
- large plasma fractal is generated. Next, a pointer is assigned.
- This pointer will define the top-left corner of the area of the
- plasma fractal which is to be displayed. In my implementation, 1/4
- of the fractal is displayed at a time in the swimming window, which
- means the display extends 160 pixels to the right and 100 pixels to
- the bottom of the pointer. Next, this pointer is moved about on
- the large plasma fractal. The exact pattern the pointer follows is
- defined in the data file, and is a pre-generated sin/cos function.
-
- Next, we make it twice as complex (and much, much more
- interesting!) by adding a second pointer. To display both pointers
- in the same window, we simply add the pixel values together. Since
- the pixel values have been limited to the range 0-127 we do not
- have to worry about overflow effects in our adding. An earlier
- revision (1.1) had this problem, which created a squiggly black
- line in the middle of the swim window separating pixels of below
- 255 from those which added to above 255.
-
- The result is a window 1/4 the size of the screen which holds a
- moving, bubbling plasma-looking mess. It's hard to explain; you'll
- just have to look for yourself!
-
- How about the other effects?
-
- Though "Swimming" was the original effect in Tom's Plasma, it has
- been moved aside to make way for many other effects. The first
- bunch of effects stem from a "flame" algorithm.
-
- In real life, the phenomenon of fire is caused by little pockets of
- air becoming so hot that the atoms within that pocket actually
- *glow*. Depending on the atoms in the air, many varieties of flame
- colors may be seen. Perhaps the most common, however, ranges from
- no glowing through a red glowing, then an orange and yellow glow,
- and finally a white glow at the warmest points. These heat pockets
- are created by a strongly exothermic (heat-emitting) chemical
- reaction as well as by natural convective forces in the air. In
- real life, they are also caused by embers which get caught in this
- air stream while burning, but this particular effect is not
- replicated here.
-
- The "flame" effect is firmly based in this explanation of fire,
- though it is not often explained as such. Our "fire" is in the
- form of a 320x202 pixel, flat "heat-map". All combustion takes
- place at the bottom row of the map, and is a result of random
- "flare-ups" and "flare-downs". The two heat-transfer effects --
- convection and conduction -- are treated separately; first all the
- values of the heat-map are shifted one position upwards, then each
- value is set to the average of the values surrounding it. To
- create realism, this latter effect takes the form of the sum of the
- values above and below, plus half the sum of the values to the left
- and right, plus the original value, all divided by four.
-
- This "heat-map" is then the basis of four different TPlas effects:
- Inferno, Convection, Melting, and Slime. The first two are direct,
- theory-based applications, the first making the heat map take on a
- certain set of colors and overlaying it atop the fractal and the
- second adding the heat map to the original fractal to create a
- ripple-like effect. The second two are the result of flipping this
- "heat-map" upside down and adding or overlaying it with the plasma
- fractal. Not exactly theory-based, but they look pretty darned
- cool anyway.
-
- Texture mapping is the basis for two more effects. In "texture
- mapping" the program includes a "texture map" the size of the final
- picture detailing where from the original picture the final picture
- should get its value. For instance, the texture map for the top-
- left pixel might point to position "1,1" in the original picture.
- The value at point "1,1" in the original picture is then placed in
- the top-left position of the final picture.
-
- Maps exist for two entities: a globe whose surface is made of the
- original picture, and a tinted crystal globe which refracts the
- image of the original picture, the colors tinted randomly. These
- texture maps are both included in the data file and loaded on
- program start-up. They are the basis for the "Globe (Tinted
- Crystal)" and "Planet and Moon" effects.
-
- The tinting for the globe is done in a rather interesting manner.
- Each color in the original palette is composed of a red, blue, and
- green element. Before tinting, I choose a number (0, 1, or 2) by
- which each of these elements is "shifted" to create the tinted
- palette. This number corresponds to the power of two by which the
- original element value is to be divided. For instance, if the
- 'Red' element is to be shifted by '2', the original red value would
- be divided by 2-squared (2*2 = 4) to obtain the tinted red value.
- The result is a tint which lets through a certain percentage each
- of red, green, and blue, any of 100%, 50%, or 25% of each element
- of each individual color. The tinting is then done by making
- colors 0-127 be the un-tinted colors and 128-255 be the tinted
- colors on screen, and adding 128 to the color value obtained by the
- globe's texture map. The only negative aspect of this is that if
- the swim-window was left on screen before the globe started up, it
- might contain colors above 127, and so the background may have
- tinted colors in it. Perhaps later versions will solve this
- problem or avoid it by getting rid of the swim window before the
- globe starts bouncing, but I like it when the refraction of the
- globe goes across the hard edges of the swim-window, so I'm not
- going to take it out yet ...
-
-
- Would you like to do any miscellaneous rambling?
-
- Yes I would, thank you!
-
- Everything in this little program has been around for a while, as
- far as I can tell. Certainly isn't cutting-edge! The only really
- new and original thought which went into this went into speeding up
- the plasma generation section of the code (by upwards of ten
- times!). As I have said before, the plasma fractal is based on
- random values. Random values take a lot of time to calculate
- because they involve several rather inefficient instructions
- (namely, multiplies and divides) to be made by the CPU. Since I
- already had a data file for all of the movement pointers and color
- palette data (this was before I generated the palette at run-time),
- I decided I might as well have 64 kilobytes of random values in
- there as well, pre-computed to save time.
-
- But wait! you say. It's different every time, isn't it?!? And the
- answer is, yes, it is. That is because the random number
- 'generator' (the code which reads the number from an array in
- memory) uses a pointer which tells it which number is next in the
- sequence. At program start-up, this number is initialized to a sum
- of the hour, minute, second, and hundredths of a second on the
- system clock (which is also how a random number generator is
- initialized, btw). Thus, though the sequence is essentially the
- same every time you run it, the number for each call to the random
- number generator is different.
-
- Secondly (and lastly!) this is my first true assembly program. And
- it shows. I have been programming in 'C' for a good three years
- now, but that is hardly the same as programming in assembly, is it?
- Furthermore, I'm not a computer-science major here in college; I'm
- a Chemical Engineer. I have taken one class which had anything at
- all to do with computers the year before last, and learned
- everything else I know from a few books here and there and, most
- importantly, the UseNet. Why am I telling you this? So that you
- know, as you laugh to yourself about my coding style, that I'm
- certainly not doing this as a living! I coded this because I
- enjoyed it, and I needed something new and interesting to put up on
- my screen.
-
- If you want to contact me about anything here, this is where I can
- be reached until May, 1996 (or 1995, if I don't get into the MS
- program!):
-
- tomster@wpi.wpi.edu
-
- Or, via the good old post office, at
-
- Tom Dibble
- WPI box 2466
- Worcester, MA 01609
-
- My mailbox is always open!
-
- Tom Dibble
- 3-18-94, 7-1-94
-
-
- BEHIND THE SCENES:
-
- TPlas currently resides in about ten assembly files, a few data
- generation programs (written in 'C'), and this documentation. The
- assembly files are such that any version (demo, unregistered,
- registered, or beta) can be assembled at any time (no copying of
- source code, etc). The registered version is then registered to a
- specific person and company by way of a 'C' program which changes
- a few (40) bytes in the beginning of the file. It was written on
- a 386-SX/16 based computer running DOS. Hence, no support of
- floating point units for those who care about such things.
- Assembly is taken care of by Turbo Assembler and linking by Turbo
- Link, both from Borland International, Inc. Documentation is
- generated in Word Perfect.
-
-
- ABOUT THE AUTHOR:
-
- I'm a student of Chemical Engineering at WPI, in friendly
- Worcester, MA. Currently I'm a senior, which is why things are
- running a bit slow right now. Next year I am planning on attending
- graduate school also in Chemical Engineering, also at WPI,
- focussing on working with thin palladium-based films for the
- separation of hydrogen from a reacting mixture. I first sat down
- to a computer at the end of the summer of 1991, when I was looking
- into buying this beast next to me. I started programming batch and
- script files that same year, moving up to 'C' in the spring of 1992
- (during finals week). I started programming in assembly because
- that was the only CS class available when I wanted to take it, in
- the spring of 1993. A year went by in which I programmed very
- little in assembly (mostly in 'C'), and then in the early part of
- this year I began work on Tom's Plasma. I enjoy programming,
- although I would never dream of doing it as a living.
-
-
- EFFECTS LISTING:
-
- This section of the document attempts to give you a bit of a
- description of the various modes, so you'll know what you are
- seeing when you see it. Tom's Plasma starts off in Automatic Mode
- (Semi-Automatic mode in the Registered Version), and can only be
- switched into another mode if it has been registered. Remember, in
- this mode, to see another effect hit the space-bar. It may look
- like nothing is happening; that is because most effects have 'kill-
- screens' which are activated when the effect exits. If you are
- really impatient, hit the space-bar again while the kill-screen is
- in effect and another effect will start up instantly.
-
- Plasma Cycling: This is an old and respected effect; colors
- move through a plasma fractal.
-
- Swimming: A small window in the middle of the screen
- opens up and the plasma in it starts to
- move/change.
-
- Blue Sky: Another window in the middle of the screen,
- except this time the rest of the screen is
- blacked out, and the window holds a vision of
- blue skies and spider-web-like clouds.
-
- Inferno: This effect is quite aptly named. It is a
- nice, big fire set on the bottom of your
- screen.
-
- Slime: Blue-green slime pours down from the top of
- the screen.
-
- Convection: Ripples of convecting heat rise from the
- bottom of the screen.
-
- Melting: The screen ripples and melts from the top of
- the screen.
-
- Globe, Tinted Crystal: A small crystal globe let loose on the
- screen, bouncing about inside an invisible
- rectangular border.
-
- Planet and Moon: A starry night, a planet spins as its lone
- moon circles overhead. Yeah, I know the stars
- wouldn't twinkle if seen from space. And yes,
- I also know that that moon is far, far too
- close to the planet. Details, details.
-
-
- KEYBOARD COMMANDS:
-
- All Modes:
-
- <Enter> Generate a new fractal (random screen clear).
- <Esc> Get me the heck out of here!
- 'A' Enter Automatic Mode
- 'S' Enter Semi-Automatic Mode (Registered Version
- Only!)
- 'M Enter Manual Mode (Registered Version Only!)
-
- Automatic Mode:
-
- <Space> New Fractal
-
- Manual Mode:
-
- '1'-'3' New fractal of variable smoothness. '1'
- (rough) is default.
- <Space> Toggle between Cycle and Swim.
- 'c' Convection.
- 'i' Inferno.
- 'm' Melt Screen.
- 's' Slime.
- 'b' Blue Sky.
- 'p' Planet and Moon.
- 'g' Globe (clear crystal)
-
- Semi-Automatic Mode:
-
- (Same as Manual except <Space> same as Automatic Mode)
-
-
- CAVEATS ABOUT KEYBOARD COMMANDS (Please read):
-
- You knew this was coming. Some of the effects of Tom's Plasma (all
- the 'fire' effects, most noticeably) have a 'kill-screen'. When a
- key is hit to start up another effect and these effects are on
- screen, they go through their kill-screen. For the flame effects,
- this kill-screen moves them up (or down) off the screen until they
- dissapear. For the Planet and Moon and Blue Sky effects this kill-
- screen throws the screen back and then lets the original colors of
- the Plasma bleed in. After the kill-screen is done, your key
- command will be processed. If you are impatient, you may hit the
- key again, and the kill-screen will end and your key will be
- processed immediately. If you press a key which is different from
- the first one you pressed, the *second* key will be processed,
- *not* the first!
-
- The only real difficulty this gives rise to is when a kill-screen
- is already in effect because the timer went out on the effect. The
- flames kill screen takes about a second before it is noticeable.
- Hitting a key twice in this instance may produce unwanted results.
- For instance, if the kill-screen for 'Slime' just started, and you
- are in Semi-Automatic Mode, and you press 'i' twice to start up
- 'Inferno', the first 'i' will *start* 'Inferno', while the *second*
- 'i' will tell it to restart! You will go directly into the kill-
- screen for 'Inferno', and then it will start again!
-
- This is not a major inconvenience, in most cases. Simply realize,
- if this happens, that this is what has happened (the machine has
- *not* decided it just doesn't like you anymore!) Hit the key a
- third time if necessary to restart the intended effect immediately.
-
-
- ACKNOWLEDGEMENTS:
-
- I couldn't have done this without a good lot of support from those
- around me. First and foremost, Jodi, who put up with me all those
- times I got an idea and had to put it in *right away*. Next, my
- "Beta Testers", including Ken Griest, Tom Guyette, and John Henry,
- who pointed out many an improvement. Finally, all those who
- praised and criticized the earlier revision, 1.1. If I missed
- anyone, fill your name in here: _______________
-
-
- REVISION HISTORY:
-
- This is by no means a finished work. I don't know how much more
- I'll do with it before sending it to the great archive in the sky,
- but, time permitting, I plan to do a bit more with it at least ...
- Perhaps I should add some sort of menuing system rather than
- relying solely upon mnemonics (which are destined to run out
- soon!). But then, if I ever get that working it's definitely 3.0
- time, as that will involve some major changes. Of course, I'm
- always on the lookout for new effects to try out (suggestions
- welcome!) Anyway, this is where it is now and where it's been, for
- what it's worth.
-
-
- October 10, 1994: Revision 2.0
- Wow, it's been a while playing with this new version, and it
- shows! We've gone beyond just Swimming by quite a bit now,
- and made a product people might actually pay money for! As a
- result, this revision is not free anymore; a $10 registration
- fee is required after 30 days, which gives the user lots of
- extra goodies in the control department as well as full, re-
- organized, source-code if he so desires. A quick run-down on
- what was added and approximately when: First came fire. I
- played around with a demo of a flame algorithm to make it
- full-screen, then tweaked the algorithm itself until it
- produced a semi-realistic effect and worked in real-time.
- This effect takes on four forms in TPlas 2.0: Inferno,
- Convection, Slime, and Melting. After I had all these effects
- to play around with, I decided it would be a good idea to have
- the computer randomize the order in which they were put up on
- screen. This required some minor re-working of the individual
- functions to get it to work as a sort of add-on, and later
- brought on a major restructuring of the program into three
- major modes. Originally, this was called 'random-mode' and
- was entered and exited via the 'r' key. This led to great
- confusion, however, so I added the 'R' key to exit and the 'r'
- key to enter, and later, when the aforementioned restructuring
- took place, the 'A' key to enter ('Auto-Mode') and the 'M',
- 'S', or <Esc> keys to exit. In the restructuring I designated
- all lower-case keys as effects hotkeys, all upper-case as
- mode-change hotkeys. A context-sensitive help system (for
- what little difference in "context" there is) was added during
- the restructuring. The flames algorithm acquired an exit-
- screen, where the flames move up the screen with no generation
- until they disappear. Then I started playing with texture-
- mapping. The first effect in this area was the 'Globe, Clear
- Crystal' effect: a bouncing, crystal-clear ball over the
- Plasma display. Next came the Planet, to which I added stars
- and an encircling Moon to form the Planet and Moon effect.
- The plasma fractal was made to wrap-around left to right, top
- to bottom in order for the planet not to look totally goofy.
- Somewhere in there I also added the Blue Sky effect and the
- wash-out screen clear/regeneration sequence. The fly-back
- exit was added to the Planet and Moon and Blue Sky effects and
- delays were introduced so that a maximum speed exists for all
- effects, no matter how fast the computer is. Some keys were
- reassigned from their early-beta meanings to ones which made
- sense, and the regeneration effect became preceded by one of
- four random screen clears ("None", "Fly-Back", "Peel-Back", or
- "Washout"). Finally, I took the palette out of the data file
- and generated it randomly, as by this point I was rather sick
- of the default (revision 1.1) palette, no matter how good it
- looked. During Beta testing I figured out how to speed up the
- 'flame' effects with little cost to the effect itself. They
- now run twice as fast as before, and the release of this
- revision will be delayed accordingly (I feel it important to
- include this improvement in this release). As per the request
- of a certain beta-tester, tinting was added to the "Clear
- Crystal" globe and the name changed to *Tinted* ("I can't see
- the little clear ball bouncing around without straining my
- eyes!"). Told you a lot has happened since last revision!
- Oh! Packaging! TPLAS20.ZIP contains the entirety of the
- unregistered version of Tom's Plasma, Revision 2.0, as well as
- the Demonstration version for use in certain business settings
- (see above, "If You Are a Business"). Also included is the
- source for TPLAS11 as an example to programmers of the Plasma
- effect, such that the TPLAS20 package can replace the TPLAS11
- package in circulation with no loss of utility.
-
- March 19, 1994: Revision 1.1
-
- Fixed all bugs which had caused anomalies in the fractal
- (involved overflow of byte values). Shrunk the data file by
- about 28k by reducing the palette stored to that which we used
- (four full palettes, not 40). Added lots of keyboard
- commands: <Space> to toggle swim window on and off, <Enter>
- for a new fractal; '1', '2', and '3' for progressively
- smoother fractals ('1' is default). <Esc> is now the only key
- which exits. This is also the first version to be uploaded
- for public consumption (I had 1.0 all packaged and ready to
- go, then decided I'd better fix those bugs ... and I suppose
- I got carried away ... :-> ). Source code, for what it's
- worth, included in package, along with data file generator
- source and executable. Oh, I cleaned up the code a bit as
- well, using the ARG directive rather than obscure equates,
- adding a few helpful comments, etc.
-
- March 3, 1994: Revision 1.0
-
- The first working version! Start it up, watch it go! Hit any
- key and it's outta there! Simple, but cool. Generates Plasma
- Fractal, starts Swimming effect. Then Leaves. Never actually
- released.
-